import { INestApplication } from "@nestjs/common";
import { DocumentBuilder, SwaggerModule } from "@nestjs/swagger";
import { knife4jSetup } from "nest-knife4j";

export const setupSwagger = (app:INestApplication) => {
  const options = new DocumentBuilder()
    .setTitle('基于知识图谱的图书推荐系统')
    .setDescription('基于知识图谱的图书推荐系统api文档')
    .setVersion('1.0')
    .setContact(
      "久燚",
      "",
      "zjyjiuyi@163.com")
    .build()
  const document = SwaggerModule.createDocument(app, options)
  SwaggerModule.setup('api', app, document)
  knife4jSetup(app, [
    {
      name: '2.X版本',
      url: `/api-json`,
      swaggerVersion: '2.0',
      location: `/api-json`,
    },
  ])

}
